<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>根据时间问好</title>
		
	</head>
	<body>
		<div id="myimage" >
			<!--<img src="img/moon.gif" />-->
			
			
		</div>
	</body>
	<script type="text/javascript">
			
			
			
			var now=new Date();
			var hour=now.getHours();
			document.write("现在是"+hour+"点"+"<br/>");
			if(hour>=6&hour<=12){
				document.write("上午好，欢迎来到贵美"+"<br/>");
				for(var i=0;i<8;i++){
                var img = new Image();

                img.src ="img/smile.gif";

			document.getElementById('myimage').appendChild(img);					
				}
			}else if(hour>12&hour<=20){
				
				document.write("下午好，欢迎来到贵美"+"<br/>");
			for(var j=0;j<8;j++){
	           var img = new Image();

              img.src ="img/aftermoon.gif";

			document.getElementById('myimage').appendChild(img);
					
				}
			}else{
				document.write("夜深了，该休息了"+"<br/>");
				for(var k=0;k<8;k++){
               var img = new Image();

              img.src ="img/moon.gif";

			document.getElementById('myimage').appendChild(img);					
				}
				
			}
			
		</script>
	
</html>
